package com.iss.springdemo1.mvc.service;

import com.iss.springdemo1.mvc.model.ResponseMessage;
import com.iss.springdemo1.mvc.model.User;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserService2 {

    public ResponseMessage login(User user){

        System.out.println("username:"+user.getUsername());
        ResponseMessage responseMessage = new ResponseMessage();
        responseMessage.setFlag(true);

        return responseMessage;
    }


    public ResponseMessage removeByUserId(int userid){
        //dao 调用数据库处理
        System.out.println(userid);
        ResponseMessage responseMessage = new ResponseMessage();
        responseMessage.setFlag(true);

        return responseMessage;
    }

    public List<User> list() {

        User user1 = new User();
        user1.setUsername("user1");

        User user2 = new User();
        user2.setUsername("user2");

        ArrayList<User> users = new ArrayList<>();

        users.add(user1);
        users.add(user2);

        return  users;


    }

    public List<User> getListByRole(int role) {
        System.out.println(role);
        User user1 = new User();
        user1.setUsername("user1");

        User user2 = new User();
        user2.setUsername("user2");

        ArrayList<User> users = new ArrayList<>();

        users.add(user1);
        users.add(user2);

        return  users;
    }
}
